func canJump(nums []int) bool {
    maxCover := nums[0]
    for i:=0; i<=maxCover; i++ {
        if maxCover >= len(nums)-1 {
            return true
        }
        maxCover = max(maxCover, nums[i]+i)
    }
    return false
}

func max(a int, b int) int {
    if a > b {
        return a
    }
    return b
}